#include <iostream>
#include <fstream>
#include <assert.h>
#include <malloc.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <iomanip>
#include <vector>
#include "EA.h"
using namespace std;

char 		*chArg4;     //entrada
char 		*chArg6;     //arquivo de sa�da resultados
char * GraphArq;
char *PopArq;
FILE *Stream;

int main(int argc, char *argv[]) {
	int c;
	//int inGeneration;
	int seed,numPopInicial, inPopSize, inNumberGenerations, inRestriction, inNumberNodesGraph;
	float alfa;
	
	seed = 0;
	numPopInicial = 0;
	int numberExec = 0;
	inPopSize = 0;
	inNumberGenerations = 0;
	inRestriction = 0;
	inNumberNodesGraph = 0;
	//-n numero de geracoes -e tamanho da elite -p tamanho da populacao inicial -g arquivo contendo o grafo -t arquivo com a populacao inicial -o arquivo com arvore de referencia (one max tree) -s seed -r restricao (d-mst) -G graph size -k numero de execucoes
	 while ( (c = getopt (argc, argv, "s:n:e:p:a:t:J:r:G:")) != -1)
	{
		switch (c)
      		{
      			/*case 's':
				seed = atoi (optarg);
			break;*/
      			case 'n':
				inNumberGenerations = atoi (optarg);
			break;
      			case 'e':
				inPopSize = atoi (optarg);
			break;
			case 'p':
				numPopInicial = atoi (optarg);
			break;
			case 'a':
				GraphArq = optarg;
			break;
			case 't':
				PopArq = optarg;
			break;
			case 'r':
				inRestriction = atoi (optarg);
			break;
			case 'G':
				inNumberNodesGraph = atoi (optarg);
			break;
			case 'J':
				numberExec = atoi (optarg);
			break;
			default:
				exit(EXIT_FAILURE);
			break;
		};
	}
	//printf("depois da extracao da linha de comando \n");
	printf ("linha de comando seed %d, numero de geracoes %d, tamanho da populacao %d, populacao inicial %d, arquivo do grafo %s,restricao %d numero execucoes %d \n", seed, inNumberGenerations, inPopSize,numPopInicial, GraphArq, inRestriction, numberExec);
	
	
	EARun(inNumberGenerations, inPopSize, inRestriction, numberExec);

	printf("Resultados salvos!\n");

	return EXIT_SUCCESS;
}

